import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)
import Layout from '@/layout2' //页面整体布局
/**
 * constantRoutes
 *没有权限要求的页面
 *可以访问所有角色
 */
export const constantRoutes = [{
		path: '/redirect',
		component: Layout,
		meta: {
			title: '重定向',
		},
		hidden: true, //不需要显示在侧边导航
		children: [{
			path: '/redirect/:path(.*)',
			component: () => import('@/views/redirect/index')
		}],
	},
	{
		path:'/Login',
		name:"Login",
		meta:{title:"登录"},
		hidden:true,
		component: () => import('@/views/Login/Login')
	},
	{
		path:'/Register',
		name:"Register",
		meta:{title:"注册"},
		hidden:true,
		component: () => import('@/views/Register/Register')
	},
	{
		path:'/subWindow',
		name:"subWindow",
		meta:{title:"调试"},
		hidden:true,
		component: () => import('@/views/subWindow/subWindow')
	},
	{
		path:'/databaseWindow',
		name:"databaseWindow",
		meta:{title:"数据库信息"},
		hidden:true,
		component: () => import('@/views/databaseWindow/databaseWindow')
	},
	
]
/**
 *异步路由
 *需要根据用户角色动态加载的路由
 */
export const asyncRoutes = [{
		path: '/',
		component: Layout,
		redirect: '/Home',
		children: [{
			path: '/Home',
			name: 'Home',
			meta: {
				title: '首页',
				icon: 'el-icon-s-home'
			},
			isTopDirectory: true, //是否作为上级目录
			component: () => import('@/views/Home/Home')
		}]
	},
]
const routes = constantRoutes.concat(asyncRoutes)
const router = new Router({
	// mode: 'history',
	// base: 'oa_office',
	routes
})

export default router